﻿@using LotteryVoteMVC.Models
@using LotteryVoteMVC.Resources
@using LotteryVoteMVC.Utility
@model PagedList<BetUpperLimit>
@{
    Layout = null;
}
@{int index = 1;
  Func<BetUpperLimit, string> GetColClass = it =>
  {
      if (it.StopBet) return "canceld";
      return it.TotalBetAmount > (it.UpperLlimit * 0.8m) ? "willFull" : string.Empty;
  };
}
<!DOCTYPE html>
<html>
<head>
    <title>@Resource.UpperLimit</title>
    <script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery-ui-1.8.11.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.cluetip.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/Customer/comm.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/Customer/DynamicRange.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/Customer/ajaxHelper.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/Customer/addUser.js")" type="text/javascript"></script>
    <link href="@Url.Content("~/Content/themes/base/jquery.ui.theme.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/jquery.cluetip.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/comm.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/TableBase.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/Pager/pagerGray.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/inputs.css")" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        $(document).ready(function () {
            $('span.custom-width').cluetip({ width: '50px', showTitle: false });
        });
    </script>
</head>
<body>
    <div id="searchBar">
        <input type="button" name="reload" id="reload" value="@Resource.Refresh" onclick="reloadPage();" /></div>
    <table cellpadding="0" cellspacing="0">
        <thead>
            <tr>
                <td>
                    @Resource.No
                </td>
                <td>
                    @Resource.Num
                </td>
                <td>
                    @Resource.TotalBetAmount
                </td>
                <td>
                    @Resource.DropWater
                </td>
                <td>
                    @Resource.NextLimit
                </td>
                <td>
                    @Resource.UpperLimit
                </td>
                <td>
                    @Resource.Function
                </td>
            </tr>
        </thead>
        <tbody>
            @foreach (var limit in Model)
            { 
                <tr class="@GetColClass(limit)">
                    <td>
                        @(index++)
                    </td>
                    <td style="font-weight: bold; font-size: 20px">
                        @limit.Num
                    </td>
                    <td>
                        <strong>
                            @limit.TotalBetAmount.ToString("N")
                        </strong>
                    </td>
                    <td>
                        <a href="javascript:buildFrame('addDrop','300','500','/DropWater/AddTodayDrop/@limit.LimitId','@limit.DropValue')"><strong>@limit.DropValue</strong></a>
                    </td>
                    <td>
                        <span class="custom-width" rel="/DropWater/GetDropByLimit/@limit.LimitId?amount=@limit.NextLimit">@limit.NextLimit.ToString("N")</span>
                    </td>
                    <td>
                        @limit.UpperLlimit.ToString("N")
                    </td>
                    <td>
                        @Html.ActionLink(limit.StopBet ? Resource.Start : Resource.Stop, "UpdateUpperLimit", new { LimitId = limit.LimitId, AcceptBet = !limit.StopBet })
                        <a href="javascript:buildFrame('EditUpperLimit','260','500','/Limit/EditUpperLimit/@limit.LimitId','')">@Resource.AddLimit</a>
                    </td>
                </tr>
            }
        </tbody>
    </table>
    @Html.Pager(Model)
</body>
</html>
